monad is package {

  type Maybe of %a is
  	   Nothing 
    or Just(%a);

  contract monad over %%m is {
    return has type (%a) => %%m of %a;
    bind has type (%%m of %a, (%a) => %%m of %b) => %%m of %b
    fail has type () => %%m of %a;
  };

  implementation monad over Maybe is {
    return(x) is Just(x);
    bind(m, f) is
			case m in {
			  Nothing is Nothing;
			  Just(v) is f(v);
			 };
    fail() is Nothing;
  };
}
